<%@ page contentType="text/html;charset=UTF-8" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<%@ include file="/common/hallimport.jsp" %>
<link href="${ctx}/css/hall.css" rel="stylesheet">
<link href="${ctx}/css/web_style.css" rel="stylesheet">
<script src="${ctx}/js/web/tab.js"></script>
<script src="${ctx}/js/layer/layer.js"></script>
<title>竞价标的-竞价大厅</title>
</head>
<body>
<%@ include file="/common/halltop.jsp" %>
<div  id="content" class="fixedw">
	 <!-- 公告 -->
    <%@ include file="jjdt-top.jsp" %>
  <div class="main">
  <div class="left">
  <h5 class="con_title"><span></span> 竞价标的  </h5>
	<!-- 搜索开始 -->
     <div class="searchForm">
     <form id="runningList_form">
		<input type="hidden" name="page"  value="1">
		<input type="hidden" name="rows"  value="12" id="rows">
		<input type="hidden" name="direction"  value="T">
		<input type="hidden" name="methodKey"  value="itemList">
		<input type="hidden" name="tag"  value="div" id="tag">
		<input type="hidden" name="itemStatus"  value="2">
		<!-- <select name="itemStatus">
		<option value="2">所有状态</option>
		<option value="B">自由报价期</option>
		<option value="C">限时报价期</option>
		</select> -->
		<input type="text" name="itemName"  value=""  tip="标的名称" placeholder="标的名称" /><a class="searchbtn" iconCls="icon-search" onclick="runningListSearch();">查询</a>
	</form>
	<ul class="fltab fr" id="fltab">
       <li class="cur"></li>
       <li></li>
    </ul>
	</div>
	<!-- 搜索结束 -->
	<div class="flcon" id="flcon">
    <ul class="img_list" id="runningList_div"></ul>
     <script type="text/template" id="runningList_div_html">
	 <? for ( var i = 0; i < rows.length; i++) {?>
	   <li>
		<input type=hidden name=ids value=<?=rows[i].itemId?> >
      	<a onclick="gotohall('<?=rows[i].itemId?>');"><img src="<?=strUtil.doNull(rows[i].picUrl,'${ctx}/images/def.jpg')?>"/></a>
      	<div class="img_list_txt" >
	      	<h3><a title="<?=rows[i].itemName?>" onclick="gotohall('<?=rows[i].itemId?>');"><?=strUtil.subStr(rows[i].itemName,15)?></a></h3>
	      	<div class="curprice">当前价：<span class="value_<?=rows[i].itemId?>"></span><?=rows[i].priceUnit?> （<em class="num_<?=rows[i].itemId?>"></em>次报价）</div>
	      	<div class="firstPrice">起始价：<span><?=rows[i].firstValuePre?></span><?=rows[i].priceUnit?></div>  
	        <div class="time"><span id=prompt1_<?=rows[i].itemId?>>--</span>：<span class="sptime_<?=rows[i].itemId?>">--</span></div>
            <div class="img_status status_<?=rows[i].itemId?>"></div>
	     </div>
      </li>	
     <?}?>
	 </script>
     <ul style="display:none">
	 <table id="runningList_table" class="tb_list" cellspacing="1" cellpadding="0">
		<tr class='active' id="title2" >
			<th width='25%'>标的名称</th>
			<th width='9%'>竞价方式</th>
			<th width='8%'>起始价格</th>
			<th width='8%'>当前价格</th>	
			<th width='8%'>报价次数</th>
			<th width='8%'>最高报价人</th>
			<th width='10%'>竞价状态</th>
			<th width='14%'>剩余时间</th>		
		</tr>
	</table>
	</ul>
	</div>
	<div id="runningList_page" class="web_pages"></div>
	<script type="text/template" id="runningList_table_html">
	<? for ( var i = 0; i < rows.length; i++) {?>
		<tr id=item_<?=rows[i].itemId?>>
			<td class="td_left pl5px">
				<input type=hidden name=ids value=<?=rows[i].itemId?> >
				<a onclick="gotohall('<?=rows[i].itemId?>');"><?=strUtil.subStr(rows[i].itemName,15)?></a>
			</td>
			<td><?=bidModeText(rows[i].bidMode)?></td>
			<td class="td_right"><?=rows[i].firstValuePre?></td>
			<td class="td_right value_<?=rows[i].itemId?>">--</td>
			<td class="num_<?=rows[i].itemId?>">0</td>
			<td class="user_<?=rows[i].itemId?>">--</td>
			<td class="status_<?=rows[i].itemId?>">--</td>
			<td class="sptime_<?=rows[i].itemId?>">--</td>
		</tr>
	<?}?>  		
	</script>
</div>
<div class="right">
<h5 class="con_title"><span></span> 最新活动</h5>
	<form id="sessionList_form">
		<input type="hidden" name="page"  value="1">
		<input type="hidden" name="rows"  value="10">
		<input type="hidden" name="status"  value="2">
		<input type="hidden" name="direction"  value="T">
		<input type="hidden" name="methodKey"  value="sessionList">
		<input type="hidden" name="tag"  value="div">
	</form>
	<div class="tj_box" id="sessionList_div"></div>
       <script type="text/template" id="sessionList_div_html">
	       <? for ( var i = 0; i < rows.length; i++) {?>
			  <dl>
                <dt><a href="#"><img src="<?=strUtil.doNull(rows[i].picUrl,'${ctx}/images/def.jpg')?>"/></a></dt>
				<dd>
				<h5><a href="${ctx}/admin/hall/session/<?=rows[i].sessionId?>" title="<?=rows[i].sessionName?>"><?=strUtil.subStr(rows[i].sessionName,10)?></a></h5>
				<p>当前状态：<span><?=sessionStatusText(rows[i].status)?></span></p>
          		<p>开始时间：<span class="time"><?=rows[i].openTime?></span></p>
                </dd>
			  </dl>
		  <?}?> 
	   </script>
	   <div class="r_more"><a href="/sendPage/hall/sessionList">查看更多活动>></a></div>
   </div>
  </div>
</div>
<%@ include file="/common/hallbottom.jsp" %>
</body>
</html>

<script>
var itermIds = "";
//打开查看页面
function gotohall(itemId){
	window.location.href= ctx+spaceDomain+"hall/item/"+itemId;
}

//查询提交
function runningListSearch(){
	searchSubmit("hall","runningList");
}
//查询提交
function sessionListSearch(){
	searchSubmit("session","sessionList");
}

function getIds(){
	var itermIds = "";
	$("input[name='ids']").each(function(){
		itermIds += $(this).val()+",";
	});	
	return itermIds;
}

function myLoad(){
	var itermIds =getIds(); 
	$.ajax({
		   type:'get',
		   url:ctx+spaceDomain+'hall/cacheList',
		   data:{ids:itermIds},
		   dataType:'json',
		   success: function(myData){
			   //alert(myData.total);
			   if(myData.total>0){
			     myData.rows.forEach(function(e){
			    	 /**
			    	 以前是以id，但是此也存在图文和数字列表，故更换使用class属性定位 add 0510 xhe 
			    	 $("#value_"+e.itemId).html(e.lastValue) ;
			    	 $("#num_"+e.itemId).html(e.bidTimes) ;
			    	 $("#user_"+e.itemId).html(e.userName) ;
			    	 $("#status_"+e.itemId).html(itemStatusTxt(e.status)) ;
				     $("#sptime_"+e.itemId).html(spareTxt(e.spareTime)) ;
			    	 **/
				     
			    	 /**
			    	 $(".value_"+e.itemId).html(e.lastValue) ;
			    	 $(".num_"+e.itemId).html(e.bidTimes) ;
			    	 $(".user_"+e.itemId).html(strUtil.doNull(e.userName,"--")) ;
			    	 $(".status_"+e.itemId).html(itemStatusTxt(e.status)) ;
				     $(".sptime_"+e.itemId).html(spareTxt(e.spareTime)) ;
				     **/
				     $(".status_"+e.itemId).html(itemStatusTxt(e.status)) ;
			    	 $(".value_"+e.itemId).html(e.lastValue) ;
			    	 $(".num_"+e.itemId).html(e.bidTimes) ;
			    	 var defTime=$("#defaultTime_"+e.itemId).val();
			    	 if(defTime && defTime.indexOf("205")!=-1){
			    		 $(".sptime_"+e.itemId).html("待定") ;
			    	 }else{
				         $(".sptime_"+e.itemId).html(spareTxt(e.spareTime)) ;
			    	 }
			    	 $(".user_"+e.itemId).html(strUtil.doNull(e.userName,"--")) ;
			    	 if(e.status=="A"){
			    	   $("#prompt1_"+e.itemId).html("距开始") ;
			    	 }else{
			    	   $("#prompt1_"+e.itemId).html("距结束") ;
			    	 }

				 });  
			   }
		  }
	});	
}
//初始化加载
$(function(){
	//加载分页列表
	runningListSearch();
	sessionListSearch();
	//myLoad();
	setInterval(myLoad,3000);
	tabcon2("fltab","flcon");	
});

</script>

